package com.zhome.gateway.enums;

/**
 * @author cuiyh9
 * @date 2020/5/9
 */
public enum ZhomeHttpEnum {
    /**
     *  http method
     */
    POST("post"),
    GET("get"),
    PUT("put"),
    DELETE("delete"),;

    private String method;

    ZhomeHttpEnum(String method) {
        this.method = method;
    }

    private String getMethod() {
        return this.method;
    }

    public static boolean isPostMethod(String method) {
        return ZhomeHttpEnum.POST.method.equalsIgnoreCase(method);
    }

    public static boolean isGetMethod(String method) {
        return ZhomeHttpEnum.GET.method.equalsIgnoreCase(method);
    }

    public static boolean isPutMethod(String method) {
        return ZhomeHttpEnum.PUT.method.equalsIgnoreCase(method);
    }

    public static boolean isDeleteMethod(String method) {
        return ZhomeHttpEnum.DELETE.method.equalsIgnoreCase(method);
    }

    public static boolean isNotSuccessCode(int code) {
        return 200 != code;
    }

}
